<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>创客英雄</title>
<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
<link href="__TMPL__Portal/assets/css/ckyx.css" rel="stylesheet">
<script src="__TMPL__Portal/assets/js/ckyx.min.js"></script>
<link href="__TMPL__Portal/assets/css/main.css" rel="stylesheet">
    <script src="__PUBLIC__/js/layer/layer.js"></script>
    <script src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.min.js"></script>
</head>

<body>
<!--header-->
<tc_include file="head" />
<div class="nav_box">
    <div class="container">
        <div class="row">
            <a class="logo col-md-2" href="index.html">
                <img src="__TMPL__Portal/assets/images/logo.png">
            </a>
            <tc_include file="nav" />
        </div>
    </div>
</div>

<!--banner_2-->
<div class="container banner_2">
	<img src="__TMPL__Portal/assets/images/zsxc.png">
</div>

<!--main3-->
<div class="container main3_box">
	<div class="ysbkbt">
        <div>重置密码</div>
    </div>
	<div class="main1_left main3 main5">
		<div class="twbk">        	
			<div class="dlkj">
            	<div class="dlkjnr">
                    <input value="{$email}"  id="email" style="display: none;"/>
                    <div class="input-group mima">
                        <input type="text" class="form-control" placeholder="请输入验证码" id="code">
                    </div>
                    <div class="input-group mima">
                      <input type="text" class="form-control" placeholder="请输入您的新密码" id="psw">
                    </div>
                    <div class="input-group mima">
                      <input type="text" class="form-control" placeholder="请确认新密码" id="pswAgain">
                    </div>
                    <div class="btn-group denglu">
                        <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"
                                onClick="changePsw();">
                            立即重置
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>    
</div>

<script>
    function changePsw() {
        var code = $('#code').val();
        var psw = $('#psw').val();
        var pswAgain = $('#pswAgain').val();
        var email = $('#email').val();
        if(code == ""){
            layer.msg('验证码不能为空');
            return false;
        }
        else if(psw == ""){
            layer.msg('密码不能为空');
            return false;
        }
        else if(pswAgain != psw){
            layer.msg('两次密码不一致');
            return false;
        }
        psw = md5(psw);
        $.ajax({
            type: "POST",
            url: "{:U('Hacker/changePsw')}",
            data: {email: email, code:code, psw:psw},
            success: function (result) {
                var result = eval("(" + result + ")");
                if (result.status) {
                    location.href = "{:U('Hacker/dl')}";
                } else {
                    layer.msg(result.message);
                }
            }
        });
    }
</script>

<!--页脚-->
<tc_include file="footer" />

</body>
</html>
